package org.aka.test;

import android.hardware.SensorManager;

public class Utils {
	
	public static double[] acc2angles(float acc[]) {
		
		double result[] = new double[3]; 
		
		double x = -acc[0] / SensorManager.GRAVITY_EARTH;
		double y = -acc[1] / SensorManager.GRAVITY_EARTH;
		double z = acc[2] / SensorManager.GRAVITY_EARTH;
		double a = Math.sqrt(x*x + y*y + z*z);
		
		result[0] = Math.asin(x/a);
		result[1] = Math.asin(y/a);
		result[2] = Math.asin(z/a);
		
		return result;
		
	}

}
